const path = require('path');
const AdmZip = require("adm-zip");

const unCompressFromBuffer = (pathname,data)=>{
    console.log("decompress data",data.length);
    const unzip = new AdmZip(data);
    console.log('extraTo:',pathname);
    try{
        unzip.extractAllToAsync(pathname);
        // unzip.extractAllToAsync(pathname,true,(err)=>{
        //     console.log("decompress",err);
        // });
    }catch(e){
        console.log("decompress",e);
    }
};


module.exports = {unCompressFromBuffer};